import QtQuick 2.7

Item {
    property int itemH;
    property alias maintext: maintext
    signal mainMouseClick;
    property string deviceInfoStr;
    property bool showinfoList: false;
    height: showinfoList?5*itemH+1:itemH+1//+infoList.height
    Rectangle{
        id:rootrectangle
        color: "black";
        width: parent.width;
        height: itemH;
        clip:true;
        Component.onCompleted: {
            console.log("x,y"+width+"  "+height);
        }

        Text {
            id:maintext
            width: parent.width;
            height: parent.height;
            color: mainmouse.containsMouse?"green":"#ffffff";
            font.bold: true;
            style: Text.Raised;
            styleColor: mainmouse.containsMouse?"red":"white";
            font.pixelSize: height*2/3;
        }
        MouseArea{
            id:mainmouse
            anchors.fill: parent
            hoverEnabled: true;
            onClicked: {
                mainMouseClick();
            }
        }
    }
    Flickable{
        clip:true
        visible: showinfoList;
        width: parent.width;
        height: 4*itemH;
        contentHeight: mainInfoArea.contentHeight;
        contentWidth: width;
        anchors.top: rootrectangle.bottom
        anchors.left: rootrectangle.left;
        Text {
            anchors.fill: parent
            id: mainInfoArea
            color: "#000000"
            wrapMode: Text.WordWrap;
            font.pointSize: 20;
            width: parent.width
            text: qsTr(deviceInfoStr);
        }
    }

    Rectangle{
        color: "white"
        width: parent.width;
        height: 1;
        anchors.bottom: parent.bottom;
        anchors.left: parent.left;
    }
}
